/*
 * PointToPointQuery.cpp
 *
 *  Created on: Nov 21, 2009
 *      Author: jbarreneche
 */

#include "PointToPointQuery.h"

PointToPointQuery::PointToPointQuery(Map *map, string originRoadName, int originHeight,
		string destinationRoadName, int destinationHeight, RouteOptimize optimizationStrategy)
		throw(RoadNotFoundException, UnexistingAddressException) :
QueryRoute(map, originRoadName, originHeight, optimizationStrategy), destination(map->createDestinationAddress(destinationRoadName, destinationHeight)) {
	safeCalculateRoute();
}

PointToPointQuery::~PointToPointQuery() { }

void PointToPointQuery::recalculateRoute() {
	this->setRemainingRoute(queriedMap->route(currentOrigin, destination, optimizationStrategy));
}

util::LinkedList<MapPoint> PointToPointQuery::finishPoints() {
	util::LinkedList<MapPoint> lista;
	lista.add(0, &destination);
	return lista;
}
